package com.jumi.microservice.service;

import com.jumi.microservice.common.base.dto.BaseRequest;
import com.jumi.microservice.common.base.dto.BaseResponse;
import com.jumi.microservice.common.base.dto.ResponseResult;
import com.jumi.microservice.common.page.TableDataInfo;
import com.jumi.microservice.dto.WaitCommentRequest;
import com.jumi.microservice.dto.WaitCommentResponse;
import com.jumi.microservice.dto.order.*;
import com.jumi.microservice.dto.pay.OrderPayListResponse;
import com.jumi.microservice.dto.shoppingcart.ShoppingCartListRequest;
import com.jumi.microservice.dto.shoppingcart.ShoppingCartRequest;
import com.jumi.microservice.dto.shoppingcart.ShoppingCartResponse;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author Dirk
 * @date 2020-10-22 13:16
 */
public interface IOrderDubboService {

    /**
     * 确认订单
     *
     * @param createOrderRequest
     * @return
     */
    ConfirmOrderResponse confirmOrder(CreateOrderRequest createOrderRequest);

    /**
     * 创建订单
     *
     * @param createOrderRequest
     * @return
     */
    CreateOrderResponse createOrder(CreateOrderRequest createOrderRequest);

    /**
     * 支付订单
     *
     * @param paymentRequest
     * @return
     */
    BaseResponse payment(BaseRequest paymentRequest);

    /**
     * 取消订单
     *
     * @param request
     * @return
     */
    Boolean cancel(OrderInfoRequest request);

    /**
     * 获取订单列表
     *
     * @param request
     * @return
     */
    TableDataInfo<OrderResponse> getOrderInfoPage(OrderInfoRequest request);

    /**
     * 获取订单列表
     * 可能存在性能问题，已舍弃 {@link IOrderDubboService#countUserOrder(UserOrderRequest)}
     *
     * @param request
     * @return
     */
    @Deprecated
    List<OrderResponse> getOrderInfoList(OrderInfoRequest request);

    /**
     * 搜索我的订单列表
     *
     * @param request
     * @return
     */
    TableDataInfo<OrderResponse> getOrderInfoSearch(OrderInfoRequest request);

    /**
     * 批量发货
     *
     * @param request
     * @return
     */
    Boolean deliverGoods(DeliverGoodsRequest request);

    /**
     * 添加订单日志
     *
     * @param request
     * @return
     */
    Boolean addOrderLog(OrderLogRequest request);

    /**
     * 查询订单日志
     *
     * @param orderSn
     * @return
     */
    List<OrderLogResponse> getOrderLogList(String orderSn);

    /**
     * 添加、减少购物车
     *
     * @param request
     * @return
     */
    Boolean addShoppingCart(ShoppingCartRequest request);

    /**
     * 批量添加购物车
     *
     * @param request
     * @return
     */
    Boolean addShoppingCart(ShoppingCartListRequest request);

    /**
     * 购物车列表
     *
     * @param uid
     * @return
     */
    ShoppingCartResponse getShoppingCart(Integer uid);

    /**
     * 批量删除购物车
     *
     * @param request
     * @return
     */
    Boolean deleteShoppingCart(ShoppingCartListRequest request);

    /**
     * 修改购物车商品
     *
     * @param request
     * @return
     */
    Boolean changeShoppingCartSku(ShoppingCartRequest request);

    /**
     * 统计各个状态的订单数量
     *
     * @param request
     * @return
     */
    Integer countUserOrder(UserOrderRequest request);

    /**
     * 预售单转实际
     *
     * @param request
     * @return
     */
    Boolean changeOrderType(ChangeOrderTypeRequest request);

    /**
     * spu 销量
     *
     * @param salesRequest
     * @return
     */
    SalesResponse getSpuSalesVolume(SalesRequest salesRequest);

    /**
     * 确认收货接口
     *
     * @param request
     * @return
     */
    Boolean confirmReceipt(OrderInfoRequest request);

    /**
     * 软删除订单
     *
     * @param request
     * @return
     */
    Boolean deleteOrder(OrderInfoRequest request);

    /**
     * 前台待评价订单列表
     *
     * @param request
     * @return
     */
    TableDataInfo<WaitCommentResponse> waitCommentList(WaitCommentRequest request);

    /**
     * 待评价订单数量
     *
     * @param uid
     * @return
     */
    Integer waitCommentCount(Long uid);

    /**
     * 获取商品运费
     *
     * @param freightTempDTO
     * @param areaId
     * @param goodsGrossWeight
     * @param goodsAmount
     * @return
     */
    BigDecimal getGoodsFreightFee(Object freightTempDTO, String areaId, BigDecimal goodsGrossWeight, Integer goodsAmount);

    /**
     * 获取用户一段时间内spu购买数量
     *
     * @param requestList
     * @return
     */
    List<ActivityUserSalesRequest> getSpuSalesVolumeActivity(List<ActivityUserSalesRequest> requestList);

    /**
     * 获取支付类型
     *
     * @return
     */
    ResponseResult<List<OrderPayListResponse>> getPayType(Integer clientType);

    /**
     * 客服系统调用 根据用户ID查询所有订单
     * @param request
     * @return
     */
    TableDataInfo<KefuOrderResponse> kefuOrderListByBuyerId(KefuOrderRequest request);
}
